﻿using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Services;
using System.Web.Services.Protocols;
using System.Xml.Linq;

namespace WMS_WebService
{
    /// <summary>
    /// RFClient 的摘要说明
    /// </summary>
    [WebService(Namespace = "http://tempuri.org/")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    [ToolboxItem(false)]
    // 若要允许使用 ASP.NET AJAX 从脚本中调用此 Web 服务，请取消对下行的注释。
    // [System.Web.Script.Services.ScriptService]
    public class RFClient : System.Web.Services.WebService
    {

       
        /// <summary>
        /// 获取托盘组盘的物料信息
        /// </summary>
        /// <param name="strTrayId"></param>
        /// <param name="ds"></param>
        /// <param name="strMessage"></param>
        /// <returns>-1:获取数据失败 0：无数据 1：获取数据成功</returns>
        [WebMethod]
        public int GetTrayMaterialInfor(string strTrayId, out DataSet ds, out string strMessage)
        {
            strMessage = "";
            ds = null;

            return new Nova_BLL.RF().GetTrayMaterialInfor(strTrayId, out ds, out strMessage);
        }

        /// <summary>
        /// 获取带订单的托盘组盘信息
        /// </summary>
        /// <param name="strTrayId"></param>
        /// <param name="ds"></param>
        /// <param name="strMessage"></param>
        /// <returns></returns>
        [WebMethod]
        public int GetTrayMaterialInforNF(string strTrayId, out DataSet ds, out string strMessage)
        {
            strMessage = "";
            ds = null;

            return new Nova_BLL.RF().GetTrayMaterialInforNF(strTrayId, out ds, out strMessage);
        }



        /// <summary>
        /// 根据物料编码获取物料的信息
        /// </summary>
        /// <param name="materialCode"></param>
        /// <param name="ds"></param>
        /// <param name="strMessage"></param>
        /// <returns>-1:获取数据失败 0：无数据 1：获取数据成功</returns>
        [WebMethod]
        public int GetMaterialInfor(string materialCode, out DataSet ds, out string strMessage)
        {
            strMessage = "";
            ds = null;

            return new Nova_BLL.RF().GetMaterialInfor(materialCode, out ds, out strMessage);
        }


        /// <summary>                                DataListMaterial
        ///  组盘添加功能
        /// </summary>
        /// <param name="strTrayId"></param>
        /// <param name="materialCode"></param>
        /// <param name="MatNum"></param>
        /// <param name="strMessage"></param>
        /// <returns>-1：失败；1：成功</returns>
        [WebMethod]
        public int RFPackage(string strTrayId, string materialCode, int MatNum, out string strMessage)
        {
            strMessage = "";

            return new Nova_BLL.RF().RFPackage(strTrayId, materialCode, MatNum, out strMessage);
        }

        /// <summary>
        /// 南方工厂入库单据组盘添加功能
        /// </summary>
        /// <param name="strStockNo"></param>
        /// <param name="strTrayId"></param>
        /// <param name="materialCode"></param>
        /// <param name="MatNum"></param>
        /// <param name="strMessage"></param>
        /// <returns></returns>
        [WebMethod]
        public int RFPackageNF(string strStockNo, string strTrayId, string materialCode, int MatNum, out string strMessage)
        {
            strMessage = "";

            return new Nova_BLL.RF().RFPackageNF(strStockNo, strTrayId, materialCode, MatNum, out strMessage);
        }


        /// <summary>
        ///组盘添加功能--含尺寸、重量类型
        /// </summary>
        /// <param name="strTrayId"></param>
        /// <param name="materialCode"></param>
        /// <param name="MatNum"></param>
        /// <param name="TypeOfSize"></param>
        /// <param name="TypeOfWeight"></param>
        /// <param name="strMessage"></param>
        /// <returns></returns>
        [WebMethod]
        public int RFPackageCommon(string strTrayId, string materialCode, int MatNum, int TypeOfSize, int TypeOfWeight, out string strMessage)
        {
            strMessage = "";

            return new Nova_BLL.RF().RFPackageCommon(strTrayId, materialCode, MatNum, TypeOfSize, TypeOfWeight, out strMessage);
        }

        /// <summary>
        /// 组盘数量的更新
        /// </summary>
        /// <param name="strTrayId"></param>
        /// <param name="materialCode"></param>
        /// <param name="MatNum"></param>
        /// <param name="strMessage"></param>
        /// <returns>-1:失败；1：成功</returns>
        [WebMethod]
        public int PackageNumUpdate(string strTrayId, string materialCode, int MatNum, out string strMessage)
        {
            strMessage = "";
            return new Nova_BLL.RF().PackageNumUpdate(strTrayId, materialCode, MatNum, out strMessage);
        }


        [WebMethod]
        public int PackageNumUpdateNF(string strStockNo, string strTrayId, string materialCode, int MatNum, out string strMessage)
        {
            strMessage = "";
            return new Nova_BLL.RF().PackageNumUpdateNF(strStockNo,strTrayId, materialCode, MatNum, out strMessage);
        }




        /// <summary>
        /// 组盘的删除功能
        /// </summary>
        /// <param name="strTrayId"></param>
        /// <param name="materialCode"></param>
        /// <param name="MatNum"></param>
        /// <param name="strMessage"></param>
        /// <returns>-1:失败；1：成功</returns>
        [WebMethod]
        public int PackageDel(string strTrayId, string materialCode, int MatNum, out string strMessage)
        {
            strMessage = "";
            return new Nova_BLL.RF().PackageDel(strTrayId, materialCode, MatNum, out strMessage);
        }


        /// <summary>
        ///南方库单据的组盘删除功能
        /// </summary>
        /// <param name="stockNo"></param>
        /// <param name="strTrayId"></param>
        /// <param name="materialCode"></param>
        /// <param name="MatNum"></param>
        /// <param name="strMessage"></param>
        /// <returns></returns>
        [WebMethod]
        public int PackageDelNF(string stockNo, string strTrayId, string materialCode, int MatNum, out string strMessage)
        {
            strMessage = "";
            return new Nova_BLL.RF().PackageDelNF(stockNo,strTrayId, materialCode, MatNum, out strMessage);
        }


        /// <summary>
        /// 获取尺寸 表示名称、数值
        /// </summary>
        /// <returns></returns>
        [WebMethod]
        public DataSet DataListSize()
        {
            return new Nova_BLL.RF().DataListSize();
        }


        /// <summary>
        /// 获取未处理单据的信息
        /// </summary>
        /// <returns></returns>
        [WebMethod]
        public DataSet DataListStorage()
        {
            return new Nova_BLL.RF().DataListStorage();
        }



        /// <summary>
        /// 根据入库单据号获取物料信息
        /// </summary>
        /// <param name="Storage"></param>
        /// <returns></returns>
        [WebMethod]
        public DataSet DataListMaterial(string StockNo)
        {
            return new Nova_BLL.RF().DataListMaterial(StockNo);
        }

        [WebMethod]
        public int GetMaterialReNum(string StockNo, string MatCode, out string strMessage)
        {
            return new Nova_BLL.RF().GetMaterialReNum(StockNo, MatCode, out strMessage);
        }


        /// <summary>
        ///  根据托盘码获取托盘尺寸类型
        /// </summary>
        /// <param name="strTrayId"></param>
        /// <param name="TypeOfSize"></param>
        /// <param name="strMessage"></param>
        /// <returns>-1:获取数据失败 0：无数据 1：获取数据成功</returns>
        [WebMethod]
        public int GetSizeByTrayId(string strTrayId, out int TypeOfSize, out string strMessage)
        {
            return new Nova_BLL.RF().GetSizeByTrayId(strTrayId, out TypeOfSize, out strMessage);
        }

        /// <summary>
        ///  pda 根据托盘号 获取出库指令展示信息 
        /// </summary>
        /// <param name="strTrayId"></param>
        /// <param name="ds"></param>
        /// <param name="strMessage"></param>
        /// <returns>-1:获取数据失败 0：无数据 1：获取数据成功</returns>
        [WebMethod]
        public int GetPDAShow(string strTrayId, out DataSet ds, out string strMessage)
        {
            return new Nova_BLL.RF().GetPDAShow(strTrayId, out ds, out strMessage);
        }


        /// <summary>
        /// PDA 过账完成
        /// </summary>
        /// <param name="TaskID"></param>
        /// <param name="strMessage"></param>
        /// <returns>-1：失败；1：成功</returns>
        [WebMethod]
        public int PDAUpdateCMDS(long TaskID, out string strMessage)
        {
            return new Nova_BLL.RF().PDAUpdateCMDS(TaskID, out strMessage);
        }

        /// <summary>
        ///  设置空托盘的尺寸等信息
        /// </summary>
        /// <param name="strTrayId"></param>
        /// <param name="TypeOfSize"></param>
        /// <param name="TypeOfWeight"></param>
        /// <param name="TypeOfZone"></param>
        /// <param name="strMessage"></param>
        /// <returns>-1：失败；1：成功</returns>
        [WebMethod]
        public int SetSpaceTrayInfor(string strTrayId, int TypeOfSize, int TypeOfWeight, int TypeOfZone, out string strMessage)
        {
            return new Nova_BLL.RF().SetSpaceTrayInfor(strTrayId, TypeOfSize, TypeOfWeight, TypeOfZone, out strMessage);
        }


        /// <summary>
        /// PDA产生入库指令
        /// </summary>
        /// <param name="TrayId"></param>
        /// <param name="SQIDS"></param>
        /// <param name="TaskID"></param>
        /// <param name="strMessage"></param>
        /// <returns>-1:失败 1：成功</returns>
        [WebMethod]
        public int PDAGenerateInputCmd(string TrayId, Int16 SQIDS, out long TaskID, out string strMessage)
        {
            return new Nova_BLL.RF().PDAGenerateInputCmd(TrayId, SQIDS, out TaskID, out strMessage);
        }




        /// <summary>
        /// PDA盘点补货管理中的增加功能
        /// </summary>
        /// <param name="strTrayId"></param>
        /// <param name="materialCode"></param>
        /// <param name="MatNum"></param>
        /// <param name="TypeOfSize"></param>
        /// <param name="TypeOfWeight"></param>
        /// <param name="strMessage"></param>
        /// <returns></returns>
        [WebMethod]
        public int RFCheckManageAdd(string strTrayId, string materialCode, int MatNum, int TypeOfSize, int TypeOfWeight, out string strMessage)
        {
            strMessage = "";

            return new Nova_BLL.RF().RFCheckManageAdd(strTrayId, materialCode, MatNum, TypeOfSize, TypeOfWeight, out strMessage);
        }

        //[WebMethod]
        //public string GetPDAShowStest()
        //{
        //    //long TaskID = 55;
        //    string strMessage = "";
        //    string strTrayId = "JFFTP000135";
        //    DataSet ds = null;

        //    int res = new Nova_BLL.RF().GetPDAShow(strTrayId, out ds, out strMessage);
        //    return res.ToString();
        //}

        //[WebMethod]
        //public string GetSizeByTrayIdtest()
        //{
        //    string strTrayId = "JFFTP000135";
        //    int TypeOfSize;
        //    string strMessage = "";
        //    int res = new Nova_BLL.RF().GetSizeByTrayId(strTrayId, out TypeOfSize, out strMessage);
        //    return res.ToString();
        //}



    }
}
